package main

import (
	"sort"
)

func findMatrix(nums []int) [][]int {
	sort.Ints(nums)
	rec := make(map[int]int)
	max_c := 0
	for i := 0; i < len(nums); i++ {
		rec[nums[i]]++
		if rec[nums[i]] > max_c {
			max_c = rec[nums[i]]
		}
	}
	mat := make([][]int, max_c)
	for k, v := range rec {
		for i := 0; i < v; i++ {
			mat[i] = append(mat[i], k)
		}
	}
	return mat
}
